<?php 
  $this->load->library('fb_api/facebook', array("appId" => $this->config->item('appId') , "secret" => $this->config->item('secret')));
  if($this->session->userdata('log_with_fb')) {
    $urlLogout = $this->facebook->getLogoutUrl(array('next' => base_url().'login_fb/logout/'));
  } else {
    $urlLogout = site_url('login_fb/logout');
  }
  //echo $this->session->userdata('log_with_fb');
?>

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"><!--<![endif]-->
<head>
<base href="<?=current_url()?>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0" />
    <title><?=$template['title']?></title>
    <?php echo $template['metadata']; ?> 
    <meta property="og:type" content="website" /> 
    <meta property="og:title" content="Parse" /> 
    <meta property="og:image" content="https://parse.com/images/home/all_platforms.png" /> 
    <meta property="og:description" content="<?=$infoPerson['name']?>" /> 
    <meta property="og:url" content="<?=current_url()?>">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap -->
    <link href="<?php echo base_url()?>public/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <link href="<?php echo base_url()?>public/css/style.css" rel="stylesheet" type="text/css">
    <link href="<?php echo base_url()?>public/prettyPhoto/css/prettyPhoto.css" rel="stylesheet" type="text/css">
    <link href="<?php echo base_url()?>public/css/font-awesome.css" rel="stylesheet" media="screen">
	<link href="<?php echo base_url()?>public/css/scrollbar.css" rel="stylesheet" media="screen">
    <script src="http://code.jquery.com/jquery.js"></script>
    <script src="<?php echo base_url()?>public/prettyPhoto/js/jquery.prettyPhoto.js"></script>
    <script type="text/javascript" src="<?php echo base_url()?>public/js/leanModal/jquery.leanModal.min.js"></script>
    <script type="text/javascript">
        var cur_router = '<?php echo $this->rout?>';
        var baseUrlJs = '<?php echo base_url()?>';
        $(document).ready(function(){
             $("a[rel*=leanModal]").leanModal({closeButton: ".modal_close"});
        });
    </script>
</head>
<body>
    <div class="container">
    <div class="row header_person" style="padding-top:20px">
        <div class="col-lg-2">
            <div class="photo_cover">
                <div class="thumbnail" style="width:150px">
                    <?php if($infoPerson['photo_cover'] !== null) : ?>
                        <img data-src="<?php echo base_url() . $infoPerson['photo_cover'] ?>" src="<?php echo base_url() . $infoPerson['photo_cover'] ?>" width="150" alt="">
                    <?php else : ?>
                        <img data-src="holder.js/160x120" alt="">
                    <?php endif ?>
                </div>
            </div>
        </div>
        <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".bs-navbar-collapse" style="z-index:9999">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
        <div class="col-lg-4">
            <h3><?php echo $infoPerson['name']?></h3>
            <p><?php echo mdate("%M %m, %Y", $infoPerson['day_birth']);?> - <?php echo mdate("%M %m, %Y", $infoPerson['day_death']);?></p>
            <p>
                <?php echo $this->person_model->get_name_state($infoPerson['state'])?>, 
                <?php echo $this->person_model->get_name_country($infoPerson['country'])?> 
            </p>
        </div>
        <?php if(isset($this->show_btn_upload) && $this->show_btn_upload === TRUE) : ?>
            <div class="col-lg-4 col-lg-offset-2" style="margin-top:70px">
                <a href="#upload-photo" rel="leanModal" class="btn btn-primary">Upload photo</a>
            </div>
        <?php endif ?>
    </div>
    <div class="row">
        <div class="nav-collapse collapse bs-navbar-collapse">
          <ul class="col-lg-8 nav navbar-nav nav-top" style="margin-left:200px">
                <li>
                  <a href="<?php echo site_url('message')?>"><i class="icon-envelope-alt"></i> Message</a>
                </li>
                <li>
                  <a href="<?php echo site_url('photo/' . $this->current_person_id)?>"><i class="icon-picture"></i> Photos</a>
                </li>
                <li>
                  <a href="<?php echo site_url('notification')?>"><i class="icon-info-sign"></i> Notification</a>
                </li>
                <li>
                  <a href="<?php echo site_url('setting')?>" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-wrench"></i> Setting</a>
                  <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
                    <li><a href="">Account</a></li>
                    <li><a href="">Avatar</a></li>
                  </ul>
                </li>
                <li>
                    <a href="#"><i class="icon-user"></i> Hi, <?php echo $this->session->userdata('sess_fullname')?></a>
                </li>
                <li>
                    <a href="<?=$urlLogout?>"><i class="icon-chevron-sign-right"></i> Logout</a>
                </li>
          </ul>
        </div>
    </div>
</div>


<!--Popup upload photo for person -->
    <script src="<?php echo base_url()?>public/upload_lib/jquery.uploadify.min.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="<?php echo base_url()?>public/upload_lib/uploadify.css">
    <div style="display:none; height:400px" id="upload-photo" class="box-lean-modal">
          <div id="signup-ct">
            <div class="signup-header">
              <h4>Plase select photo</h4>
              <a class="modal_close" href="#"><i class="icon-remove"></i></a>
            </div>
          </div>
        <form style="margin-left:20px" enctype="multipart/form-data">

          <div id="notify"></div>
          <div id="queue"></div>
          <input id="file_upload" name="file_upload" type="file" multiple="true">
        </form>
     
    </div>
    <!--End popup-->
    <script type="text/javascript">
    <?php 
        //$this->load->library('MY_Session');
        $timestamp = time();
        //$session_name = $this->session->get_js_session(TRUE);
        //$session_data = $this->session->get_js_session();
    ?>
    $(document).ready(function() {
          $('#file_upload').uploadify({
            'formData'      : {
                'personName' : '<?php echo $infoPerson['name']; ?>',
                'personId': '<?php echo $infoPerson['id']?>',
            },
            'swf'      : '<?php echo base_url()?>public/upload_lib/uploadify.swf',
            'uploader' : '<?php echo base_url()?>person/upload_photo',
            //'debug'    : true,
            'fileObjName' : 'userfile',
            'fileSizeLimit':'4096KB',
            'cancelImg': '<?php echo base_url()?>public/upload_lib/uploadify-cancel.png',
            'removeCompleted':false,
            
            'onUploadSuccess' : function(file, data, response) {
                loadListPhotoPerson('<?php echo $infoPerson['id']?>');
                //alert(data);
            },
            'onComplete' : function(event, ID, fileObj, response, data) {
                //$("#notify").html(response);
                //alert(response);
             }
          });
    });
  </script>